Lync Powershell help -getting error "Management Object Not found"

Hi,

I want to reference a list of users in Lync that do not have a HostedVoicemailPolicy applied. Please can someone help me..

I have a list of users that form a txt file I am referencing called $lynctest.

User1
User2
User3
NoSuchUser1
NoSuchUser2

I have the following and its not catching the error so that I can output to another file.

try
{
foreach($lyncuser in $lynctest)
    {
    Get-CsUser -Identity $lyncuser | select displayname, hostedvoicemailpolicy
 
}
catch
{
   write-host "$lyncuser user not found" > "c:\datatemp\listofusers.txt"
}

March 23rd, 2015 11:22am


Get-CsUser -Identity $lyncuser -ErrorAction:stop | select displayname, hostedvoicemailpolicy

Free Windows Admin Tool Kit Click here and download it now
March 23rd, 2015 11:29am

Hi, Thanks. Already tried that but doesn't work :(
March 23rd, 2015 1:46pm


Get-CsUser -Identity $lyncuser -ErrorAction:stop | select displayname, hostedvoicemailpolicy

Free Windows Admin Tool Kit Click here and download it now
March 23rd, 2015 3:27pm


Get-CsUser -Identity $lyncuser -ErrorAction:stop | select displayname, hostedvoicemailpolicy

March 23rd, 2015 3:27pm


Get-CsUser -Identity $lyncuser -ErrorAction:stop | select displayname, hostedvoicemailpolicy

Free Windows Admin Tool Kit Click here and download it now
March 23rd, 2015 3:27pm


Get-CsUser -Identity $lyncuser -ErrorAction:stop | select displayname, hostedvoicemailpolicy

March 23rd, 2015 3:27pm

Not super efficient, but quick and dirty.  If you're talking about thousands of users, this might be too slow and we can work something else out.  If you're talking about a handful, this might be fine.

foreach($lyncuser in $lynctest)

{ $founduser=Get-CSUser|Where-Object {$_.samaccountname -match $lyncuser} if ($founduser) { "The user exists" } else { "The user does not exist" }

}

Free Windows Admin Tool Kit Click here and download it now
March 24th, 2015 1:45pm


Any error messages or screen shots to help us better understand the issue?

Thanks / rgds,

March 26th, 2015 6:27pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics